/*
 * @Descripttion: 
 * @version: 
 * @Author: zhaomangang
 * @Date: 2024-06-30 15:56:15
 * @LastEditors: zhaomangang
 * @LastEditTime: 2024-06-30 16:16:03
 */



#ifndef __RECOGNITION_BAIDU_H__
#define __RECOGNITION_BAIDU_H__


#include <QObject>
#include <QJsonDocument>
#include <QJsonParseError>
#include <QJsonObject>
#include <QJsonValue>
#include <QJsonArray>
#include <QFile>
#include <QHostInfo>

// //    获取Access Token
// const QString baiduTokenUrl = "https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=%1&client_secret=%2&";
// const QString client_id = "uORPpqxmT9jlAbEshHy0ubTg";
// const QString client_secret = "VuE3zv7aK0oCKgzhvtXC4bBZbHT4CLMT";
// //    语音识别url
// const QString baiduSpeechUrl = "https://vop.baidu.com/server_api?dev_pid=1537&cuid=%1&token=%2";


class RecognitionBaiDu : public QObject
{
    Q_OBJECT
public:
    RecognitionBaiDu();
    ~RecognitionBaiDu();
    QString speechIdentify(QString fileName);
private:
    QString baidu_token_url_;
    QString baidu_speech_url_;
    QString client_id_;
    QString client_secret_;
    QString access_token_;

    void getAccessToken();
    QString getJsonValue(QByteArray ba,QString key);
    bool post_sync(QString url,QMap<QString,QString>header,QByteArray requestData,QByteArray &replyData);
};



















#endif // __RECOGNITION_BAIDU_H__